import Input from "@/components/dynamic-search/input/Index.vue";
import Select from "@/components/dynamic-search/select/Index.vue";
import type { FilterOperateEnum, SortConditionEnum } from "@/util/page-request";
import type { SelectOption } from "naive-ui";
import type { DatePickerType } from "naive-ui/es/date-picker/src/config";

const components = [Input, Select];

/** 组件类型 */
export type ComponentType = "Input" | "Select" | "DatePicker";

/** 组件实例类型 */
// export type ComponentInsType = typeof Input | typeof Select;
export type ComponentInsType = (typeof components)[number];

export type ComponentRefType = Partial<Record<ComponentType, ComponentInsType>>;

/** 模板 */
export interface FormSchema {
  type: ComponentType; // 组件类型
  label: string | undefined; // formItem 的 label
  placeholder?: string; // placeholder
  value: any; // v-model 绑定的值
  code: string; // code值
  operate: FilterOperateEnum; // 操作符
  options?: SelectOption[]; //下拉项
  isGroup?: boolean; //是否 group
  extraCode?: string; //额外的code
  extraOp?: FilterOperateEnum; //额外的 operate
  datePickerType?: DatePickerType; //当组件类型为 DatePicker 时此项发挥作用
}
